package com.example.model;

import java.util.Date;
import java.sql.Timestamp;

public class Book {
    private int id;
    private String name;
    private String title;
    private String coverUrl;
    private String coverImage;
    private String description;
    private int clicks;
    private String type; // 关联灾害类型
    private String publisher;
    private String author;
    private java.math.BigDecimal price;
    private String category; // 新增字段，兼容JSP
    private int stock;
    private Date publishDate;
    private String status;
    private Timestamp createTime; // 新增字段
    private int sales; // 新增字段
    private int views; // 新增字段

    public int getId() { return id; }
    public void setId(int id) { this.id = id; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public String getTitle() { return title != null ? title : name; }
    public void setTitle(String title) { this.title = title; }
    public String getCoverUrl() { return coverUrl; }
    public void setCoverUrl(String coverUrl) { this.coverUrl = coverUrl; }
    public String getCoverImage() { return coverImage != null ? coverImage : coverUrl; }
    public void setCoverImage(String coverImage) { this.coverImage = coverImage; }
    public String getDescription() { return description; }
    public void setDescription(String description) { this.description = description; }
    public int getClicks() { return clicks; }
    public void setClicks(int clicks) { this.clicks = clicks; }
    public String getType() { return type; }
    public void setType(String type) { this.type = type; }
    public String getPublisher() { return publisher; }
    public void setPublisher(String publisher) { this.publisher = publisher; }
    public String getAuthor() { return author; }
    public void setAuthor(String author) { this.author = author; }
    public java.math.BigDecimal getPrice() { return price; }
    public void setPrice(java.math.BigDecimal price) { this.price = price; }
    public String getCategory() { return category != null ? category : type; }
    public void setCategory(String category) { this.category = category; }
    public int getStock() { return stock; }
    public void setStock(int stock) { this.stock = stock; }
    public Date getPublishDate() { return publishDate; }
    public void setPublishDate(Date publishDate) { this.publishDate = publishDate; }
    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }
    public Timestamp getCreateTime() { return createTime; }
    public void setCreateTime(Timestamp createTime) { this.createTime = createTime; }
    public int getSales() { return sales; }
    public void setSales(int sales) { this.sales = sales; }
    public int getViews() { return views; }
    public void setViews(int views) { this.views = views; }
} 